<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>易和谐词检索模块测试版 v0.1</title>
    <style>
    
    textarea{
        float:left;
    }
    .result{
        float:left;
        width:500px;
        border:1px solid #FFF0F0;
        margin-top:0;
        margin-left:10px;
        padding-left: 5px;
    }
    .result>p:first-child{
        border-bottom:1px solid gray;
    }
    .submit{
        clear:both;
    }
    </style>
    <script type="text/javascript" src="./jquery-3.1.1.js"></script>
    <script type="text/javascript">
    function check(frm){
        if (frm.content.value=='') {
            alert("不可为空");
            return false;
            
        }else{
             var str=frm.content.value; 
  str=str.replace(/[\ |\~|\`|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)|\-|\_|\+|\=|\||\\|\[|\]|\{|\}|\;|\:|\"|\'|\,|\<|\.|\>|\/|\?]/g,""); 
            $.ajax({
                url:'form.php',
                data:'content='+str,
                type:'post',
                dataType:'json',
                success:function(re){
                    if (re!=0) {
                        var arr=re.split(",");
                        //$("#result").text(arr.join("<br>"));
                        $('#result').html('文章包含非法信息:<br>'+arr.join("<br>"));

                        // alert('文章包含非法信息--'+re+'--');
                        // $('#result').text('文章包含非法信息--'+re+'--');
                    } else {
                        $('#result').html("文章可以提交");
                    }
                }
            })

        }

    }

    </script>
</head>
<body>
<form action="form.php" name="myform" method="post">
    <textarea name="content" id="content" cols="100" rows="55"></textarea>
    <div class="result">
        <p>检测结果&nbsp <a href="white.html">添加白名单</a></p>
        <p id="result"></p>
    </div>
    <div class="submit"><input type="button" value="提交" onclick="check(document.myform);" /></div>

</form>
    
</body>
</html>